package 数据结构下

/**
 * 过滤操作,遍历->谓词判断
 */
object FilterDemo {
  def main(args: Array[String]): Unit = {

    val list = List("Alice", "Tom", "AABB")
    val value = list.filter(startA)
    println(value)
    /*结果:List(Alice, AABB)*/

  }

  def startA(str: String): Boolean = {
    str.startsWith("A")
  }

}
